    <?php $this->load->view('wedding/wedding_head');?>
    <script type="text/javascript" src="<?php echo base_url();?>js/jquery.form.js"></script>
    <script type="text/javascript">
               $(document).ready(function() { 
                var img_str = "<?php echo isset($wedding) ? $wedding['img'] : "" ?>";
				if (img_str != "") {
					var img_array = img_str.split(' ');
					var html = "";
				    for (var i = 0; i < img_array.length; i++) {
					    if ($.trim(img_array[i]) != "") {
					    	html = html + '<p><img width="100" height="50"  src="<?php echo base_url()?>'+img_array[i]+'"/><span name="'+img_array[i]+'">删除此图片</span></p>';
						}
					}
				    $('#display_img').html(html);
				}

				$('#display_img span').live('click', function() {
					var url = "<?php echo base_url()?>index.php/wedding/weddingbigserviceaction/ajax_del_img";
					var data = {id:$('#wedding_service_id').val(), path:$(this).attr('name')};
					$.post(url, data, function(aa) {
						location.reload();
					});
					
				});
				
  				$('#img_upload').ajaxForm({
				        beforeSubmit: function(a, f, o) {
			        		if ($.trim($('#upload_img_file').val()) == "") {
								alert("请选择上传文件");
								return false;
						    } 
							if ($('#flag').val() == "0") {
								if ($('#display_img img').length >= 3) {
									alert("只有vip用户才可以上传3张以上图片！");
									return false;
								}
							}
							if ($("#flag").val() == "3") {
								if ($('#display_img img').length >= 10) {
									alert("最多可以上传10张图片！");
									return false;
								}
							}
						    o.dataType = 'json';
						    
				        },
				        success: function(data) {
					          $('#upload_img_file').val('');
					          if(data.error_msg != "") {
								$('#error_msg').html(data.error_msg);
						      } else {
							    var img_array = data.path.split(' ');
								var html = "";
							    for (var i = 0; i < img_array.length; i++) {
								    if ($.trim(img_array[i]) != "") {
								    	html = html + '<p><img width="100" height="50"  src="<?php echo base_url()?>'+img_array[i]+'"/><span name="'+img_array[i]+'">删除此图片</span></p>';
									}
								}
							    $('#display_img').html(html);
						      }
					        }
					    });
		            });
    </script>
    <input type="hidden" id="page_code" value="3"/>
    <!-- begin: main content area #main -->
     <div id="main">
      <!-- begin: #col1 - first float column -->
      <div id="col1" role="complementary">
        <div class="my_box" style="margin-top: 10px;">
		<p class="box_title"><span>婚庆公司服务套餐管理</span></p>
			<div class="left_nav" style="margin: 20px 0 20px 10px;">
				<p>
					<img style="margin: 0 5px 0 5px;" src="<?php echo base_url()?>images/icon/add_s.png" /> <a href="#">套餐列表</a>
				</p>
				<p>
					<img style="margin: 0 5px 0 5px;" src="<?php echo base_url()?>images/icon/add_s.png" /> <a href="#">添加新套餐</a>
				</p>
				<p>
					<img style="margin: 0 5px 0 5px;" src="<?php echo base_url()?>images/icon/add_s.png" /> <a href="#">成为VIP</a>
				</p>
			</div>
		</div>
      </div>
      <!-- end: #col1 -->
      <!-- begin: #col3 static column -->
      <div id="col3" role="main">
        <div id="col3_content" class="clearfix">
           
           <div class="my_box">
            <p class="box_title"><span>婚庆公司服务套餐预览    图片上传    视频上传</span></p>
            
   			<dl>
          		<dt>套餐名称：</dt>
         		<dd><?php echo isset($wedding) ? $wedding['name'] : "" ?></dd>
          		<dt>套餐价格：</dt>
         		<dd><?php echo isset($wedding) ? $wedding['price'] : "" ?></dd>
          		<dt>提供服务：</dt>
         		<dd><?php echo isset($wedding) ? $wedding['tag'] : "" ?></dd>
         		<dt>套餐简介：</dt>
         		<dd><?php echo isset($wedding) ? $wedding['info'] : "" ?></dd>
   			</dl>
            <input type="hidden" id="flag" value="<?php echo isset($flag) ? $flag : "" ?>"/>
          	<form id="img_upload" action="<?php echo base_url()?>index.php/wedding/weddingbigserviceaction/img_upload" enctype="multipart/form-data" method="post">
          		<p style="margin-left:20px"> 	
          			<span style="display:block; font-weight: bold">套餐图片上传</span>
          			<span style="display:block;">
	          			您现在还不是VIP会员 最多只能上传3张图片；<br />
	          			图片大小不能超过200k、为了更好的显示你的图片图片宽度不能超过 1024 高度不能超过 768 格式请选择 jpg gif png类型的图片 
          			</span>
          			<input type="hidden" id="wedding_service_id" name="id" value="<?php echo isset($wedding) ? $wedding['id'] : "" ?>"/>
          			<span id="error_msg" style="color:red;display:block;"></span>
          			<input type="file" id="upload_img_file" name="img" style="margin-top:10px;"/> <button id="upload_img_button" type="submit">上传</button>
          		</p>
          		
          		<div id="display_img">
          		
          		</div>
          	</form>
          	
          	<form>
          		<p> 	
          			<span style="display:block;margin-left:20px; font-weight: bold">套餐视频上传</span>
          			<input type="file" name="img" style="margin-left:20px;margin-top:10px;"/> <button type="button">上传</button>
          		</p>
          		<div id="video">
          		
          		</div>
          	</form>
          </div>
        </div>
        <div id="ie_clearing">&nbsp;</div>
        <!-- End: IE Column Clearing -->
      </div>
      <!-- end: #col3 -->
    </div>
   
    <!-- end: #main -->
<?php $this->load->view('user/footer');?>